<template>
	<view class="index tn-safe-area-inset-bottom">
		<view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top"
			:style="{paddingTop: vuex_custom_bar_height + 'px'}">
			<view class="justify-content-item tn-margin-left" @click="tn('')">
				<view class="tn-text-bold tn-text-lg tn-padding-bottom-xs">
					融健科技适老化改造管理系统
				</view>
			</view>
			<view class="justify-content-item tn-color-cat tn-text-right">
				<tn-button backgroundColor="#F1C68E00" fontColor="#838383" padding="10rpx 0" width="110rpx" shadow
					open-type="share">
					<text class="tn-icon-wechat-fill tn-text-xl"></text>
				</tn-button>
			</view>
		</view>

		<swiper class="card-swiper" @click="tn('')" :circular="true" :autoplay="true" duration="500" interval="8000"
			@change="cardSwiper">
			<swiper-item v-for="(item,index) in swiperList" :key="index" :class="cardCur==index?'cur':''">
				<!-- <view class="swiper-item image-banner">
          <image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
        </view> -->
				<view class="swiper-item image-banner"
					:style="'background-image:url('+ item.url + ');background-size: cover;border-radius: 15rpx;'">
				</view>
				<view class="swiper-item-text">
					<view class="tn-text-bold tn-color-white" style="font-size: 50rpx;">{{item.title}}</view>
					<view class="tn-color-white tn-padding-top" style="font-size: 30rpx;">{{item.name}}</view>
					<view class="tn-text-sm tn-text-bold tn-color-white tn-padding-top-sm tn-padding-bottom-sm">
						{{item.text}}
					</view>
				</view>
			</swiper-item>
		</swiper>
		<view class="indication">
			<block v-for="(item,index) in swiperList" :key="index">
				<view class="spot" :class="cardCur==index?'active':''"></view>
			</block>
		</view>

		<view class="">
			<view class="box-link tn-flex">
				<view class="">
					<view class="box-link-title">
						改造申请
					</view>
					<view class="box-link-tips">
						居家养老我要更精彩
					</view>
				</view>
				<view class="box-link-image" @click="tn('/pages/apply/apply')">
					<img src="/static/go.png" alt="" />
				</view>
			</view>
		</view>

		<view class="tn-padding-bottom-lg ">

			<view class="tn-flex tn-margin-left tn-margin-right tn-margin-top">
				<view class="tn-flex-1">
					<view class="image-pic tn-margin-right"
						style="height: 100%;background-image:url('/static/banner2.png')" @click="tn('')">
						<view class="image-tuniao1">
							<view class="">
								产品中心
							</view>
							<view class="image-tuniao1-detail">
								您喜欢的都在这
							</view>
						</view>
					</view>
				</view>
				<view class="tn-flex-1">
					<view class="image-pic" style="background-image:url('/static/banner3.png')" @click="tn('')">
						<view class="image-tuniao2">
							<view class="image-tuniao2_text">
								改造场景
							</view>
						</view>
					</view>
					<view class="image-pic" style="background-image:url('/static/banner4.png');margin-top: 29rpx;"
						@click="tn('')">
						<view class="image-tuniao2">
							<view class="image-tuniao2_text">
								动态信息
							</view>
						</view>
					</view>
				</view>
			</view>


			<!-- <view class="tn-flex tn-flex-row-center tn-margin-top" @click="tn('')">
				<view class="tn-flex justify-content-item tn-margin tn-text-bold tn-text-xxl tn-flex-center">
					<img src="/static/title.png" alt="" class="title-logo" />
					<view class="">
						想改哪里
					</view>
					<img src="/static/title.png" alt="" class="title-logo" />
				</view>

			</view> -->

			<!-- 图文 -->
		<!-- 	<view class="tn-flex">
				<view class="content-box" v-for="item in content">
					<view class="tn-flex tn-flex-direction-column tn-flex-col-center">
						<img :src="item.mainImage" alt="" class="content-img" />
						<view class="">
							{{item.name}}
						</view>
					</view>
				</view>

			</view> -->

		</view>

		<view class='tn-tabbar-height'></view>

	</view>
</template>

<script>
	export default {
		name: 'Index',
		data() {
			return {
				cardCur: 0,
				isAndroid: true,
				swiperList: [{
					id: 0,
					type: 'image',
					title: '',
					name: '',
					url: '/static/banner0.png',
				},{
					id: 0,
					type: 'image',
					title: '',
					name: '',
					url: '/static/banner01.png',
				},{
					id: 0,
					type: 'image',
					title: '',
					name: '',
					url: '/static/banner02.png',
				}],
				content: [{
						userAvatar: '/static/zhuyi.png',
						name: '助急',
						date: '2021年12月20日',
						label: ['开源', '创意'],
						desc: '200元/次',
						mainImage: '/static/zhuji.png',
						collectionCount: 236,
						commentCount: 102,
						likeCount: 168
					},
					{
						userAvatar: '/static/zhuyi.png',
						name: '助洁',
						date: '2021年12月20日',
						label: ['开源', '创意'],
						desc: '150元/次',
						mainImage: '/static/zhujie.png',
						collectionCount: 265,
						commentCount: 22,
						likeCount: 62
					},
					{
						userAvatar: '/static/zhuyi.png',
						name: '助医',
						date: '2021年12月20日',
						label: ['开源', '创意'],
						desc: '260元/天',
						mainImage: '/static/zhuyi.png',
						collectionCount: 265,
						commentCount: 22,
						likeCount: 62
					},
					{
						userAvatar: '/static/zhuyi.png',
						name: '健康检测',
						date: '2021年12月20日',
						label: ['开源', '创意'],
						desc: '30元/天3次',
						mainImage: '/static/jiance.png',
						collectionCount: 265,
						commentCount: 22,
						likeCount: 62
					},
					
				]
			}
		},
		created() {
			const systemInfo = uni.getSystemInfoSync()
			if (systemInfo.system.toLocaleLowerCase().includes('ios')) {
				this.isAndroid = false
			} else {
				this.isAndroid = true
			}
		},
		methods: {
			// cardSwiper
			cardSwiper(e) {
				this.cardCur = e.detail.current
			},

			// 跳转
			tn(e) {
				uni.navigateTo({
					url: e,
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.index {
		max-height: 100vh;
	}

	/* 底部安全边距 start*/
	.tn-tabbar-height {
		min-height: 120rpx;
		height: calc(140rpx + env(safe-area-inset-bottom) / 2);
		height: calc(140rpx + constant(safe-area-inset-bottom));
	}

	/* 轮播视觉差 start */
	.card-swiper {
		height: 750rpx !important;
	}

	.card-swiper swiper-item {
		width: 750rpx !important;
		left: 0rpx;
		box-sizing: border-box;
		padding: 40rpx 30rpx 30rpx 30rpx;
		overflow: initial;
	}

	.card-swiper swiper-item .swiper-item {
		width: 100%;
		display: block;
		height: 100%;
		border-radius: 15rpx;
		transform: scale(1);
		transition: all 0.2s ease-in 0s;
		// overflow: hidden;
	}

	.card-swiper swiper-item.cur .swiper-item {
		transform: none;
		transition: all 0.2s ease-in 0s;
	}

	.card-swiper swiper-item .swiper-item-text {
		margin-top: -160rpx;
		text-align: center;
		width: 100%;
		display: block;
		height: 50%;
		border-radius: 10rpx;
		transform: translate(100rpx, -60rpx) scale(0.9, 0.9);
		transition: all 0.6s ease 0s;
		overflow: hidden;
	}

	.card-swiper swiper-item.cur .swiper-item-text {
		margin-top: -220rpx;
		width: 100%;
		transform: translate(0rpx, 0rpx) scale(0.9, 0.9);
		transition: all 0.6s ease 0s;
	}

	.image-banner {
		border: 1rpx solid #F8F7F8;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.image-banner image {
		width: 100%;
		height: 100%;
	}

	/* 轮播指示点 start*/
	.indication {
		z-index: 9999;
		width: 100%;
		height: 36rpx;
		position: absolute;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}

	.spot {
		background-color: #FFFFFF;
		opacity: 0.6;
		width: 10rpx;
		height: 10rpx;
		border-radius: 20rpx;
		top: -70rpx;
		margin: 0 8rpx !important;
		position: relative;
	}

	.spot.active {
		opacity: 1;
		width: 30rpx;
		background-color: #FFFFFF;
	}



	/* 图标容器12 start */
	.tn-three {
		position: absolute;
		top: 50%;
		right: 50%;
		bottom: 50%;
		left: 50%;
		transform: translate(-38rpx, -20rpx) rotateX(20deg) rotateY(10deg) rotateZ(-20deg);
		text-shadow: -1rpx 2rpx 0 #f0f0f0, -2rpx 4rpx 0 #f0f0f0, -10rpx 20rpx 30rpx rgba(0, 0, 0, 0.2);
	}

	.icon12 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 100rpx;
				height: 100rpx;
				font-size: 60rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;
					background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg6.png);


				}
			}
		}
	}

	/* 自定义导航栏内容 start */
	.custom-nav {
		height: 100%;

		&__back {
			margin: auto 5rpx;
			font-size: 40rpx;
			margin-right: 10rpx;
			margin-left: 30rpx;
			flex-basis: 5%;
		}

		&__search {
			flex-basis: 60%;
			width: 100%;
			height: 100%;

			&__box {
				width: 100%;
				height: 70%;
				padding: 10rpx 0;
				margin: 0 30rpx;
				border-radius: 60rpx 60rpx 0 60rpx;
				font-size: 24rpx;
			}

			&__icon {
				padding-right: 10rpx;
				margin-left: 20rpx;
				font-size: 30rpx;
			}

			&__text {
				// color: #AAAAAA;
			}
		}
	}

	.logo-image {
		width: 65rpx;
		height: 65rpx;
		position: relative;
		border: 1rpx solid #F8F7F8;
		border-radius: 50%;
	}

	.logo-pic {
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;
		border-radius: 50%;
	}

	/* 自定义导航栏内容 end */


	/* 项目 start*/
	.image-tuniao1 {
		padding: 90rpx 0rpx;
		font-size: 42rpx;
		font-weight: 600;
		position: relative;
		text-align: center;
		margin: auto;
		color: #fff;

		.image-tuniao1-detail {
			font-size: 28rpx;
		}
	}

	.image-tuniao2 {
		padding: 45rpx 0rpx;
		font-size: 42rpx;
		font-weight: 600;
		position: relative;
		text-align: center;
		color: #fff;

		&_text {
			background-color: #0093c040;
			height: 70rpx;
			width: 70%;
			margin: auto;
			line-height: 70rpx;
			border-radius: 12rpx;
		}
	}

	.image-tuniao3 {
		padding: 45rpx 0rpx;
		font-size: 42rpx;
		font-weight: 600;
		position: relative;
		text-align: center;
	}

	.image-pic {
		border: 1rpx solid #F8F7F8;
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;
		border-radius: 10rpx;
	}

	// 上门服务
	.custom-nav__search__box {
		padding: 10rpx 20rpx;
	}

	.tn-blogger-content__wrap {
		background-color: #cbdbff40;
		padding: 15rpx;
		margin: 15rpx !important;
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.image-content__box {
			display: flex;
			align-items: center;
		}


		.image-content {
			width: 120rpx;
			height: 120rpx;
			border-radius: 10rpx;
		}
	}

	/* 文章内容 start*/
	.tn-blogger-content {
		&__wrap {
			margin: 30rpx;
		}

		&__info {
			&__btn {
				margin-right: -12rpx;
				opacity: 0.5;
			}
		}

		&__label {
			&__item {
				color: #1D2541;
				background-color: #F3F2F7;
				border-radius: 10rpx;
				font-size: 22rpx;

				padding: 5rpx 15rpx;
				margin: 5rpx 0 0 18rpx;

				&--prefix {
					font-size: 24rpx;
					color: #1D2541;
					padding-right: 10rpx;
				}
			}

			&__desc {
				line-height: 55rpx;
			}
		}

		&__main-image {
			border: 1rpx solid #F8F7F8;
			border-radius: 16rpx;

			&--1 {
				max-width: 690rpx;
				min-width: 690rpx;
				max-height: 400rpx;
				min-height: 400rpx;
			}

			&--2 {
				max-width: 260rpx;
				max-height: 260rpx;
			}

			&--3 {
				height: 212rpx;
				width: 100%;
			}
		}

		&__count-icon {
			font-size: 40rpx;
			padding-right: 5rpx;
		}
	}

	.image-wallpaper {
		padding: 160rpx 0rpx;
		font-size: 40rpx;
		font-weight: 300;
		position: relative;
	}

	.image-pic {
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;
		border-radius: 10rpx;
	}

	/* 文章内容 end*/

	.box-link {
		height: 140rpx;
		width: 93%;
		margin: auto;
		border-radius: 10rpx;
		background-image: url('../../static/bg.png');
		padding: 20rpx;
		align-items: center;
		justify-content: space-around;

		.box-link-title {
			color: white;
			font-size: 44rpx;
		}

		.box-link-tips {
			color: white;
			font-size: 30rpx;
		}

		.box-link-image {
			img {
				height: 120rpx;
				width: 120rpx;
			}

		}
	}

	.title-logo {
		width: 55rpx;
		height: 55rpx;
		margin: 0 10rpx;
	}
	
	.content-box {
		width: 25%;
	}
	.content-img {
		width: 90%;
	}
</style>